<?php
include 'base.php';
include 'connectdb.php';
include 'requireLogin.php';
 ?>
<?php
	if(isset($_POST['print_code_button']))
	{
		$varCode = $_POST['formCode'];
		$stSQL="select code,sale_price from product where code ='".$varCode."'";
		$result=mysql_query($stSQL); 
		while($row = mysql_fetch_array($result)){
        	echo"<table border='1'>
        	<tr>
        	<th>Mã</th>
        	<th>Giá bán</th>
        	</tr>";
        	echo "<tr>";
        	echo"<td>".$row['code']. "</td>";
        	echo"<td>" .number_format($row['sale_price'],3)." VND"."</td>";
        	echo "</tr>";
        	echo"</table>";
		}

	}
?>
<form action="" method="post">
<div class="form_settings">
<p><span>
<select name="formCode" >
<option value="" selected="selected">..Chọn mã..</option>
<?php
$stSQL="select code from product ";
$resultsub=mysql_query($stSQL);
if(mysql_num_rows($resultsub)> 0)
{  
     while($row = mysql_fetch_array($resultsub))
    {
?>          
    <option value="<?php echo"".$row['code']."";?>"><?php echo"".$row['code']."";?></option>
                
<?php
    }
}
?>
        </select>
    </span> <input class="submit" type="submit" name="print_code_button" value="In phiếu" /></p>
    </div>
</form>
 <?php include 'footer.php';?>
